#ifndef TASK_H
#define TASK_H

#include <QObject>
#include "QTimer"
#include "QPointF"
#include "utils/gamemanager.h"
#include "CallBack.h"
#include "persent/basepersent.h"
#include "bean/authcodeinfobean.h"


class GameTask : public BasePersent,public CallBack
{
    Q_OBJECT
public:
    explicit GameTask(QWidget *parent = nullptr);
    void backgroundTask(int task);
    void stopTask();
    void callBack(QString str = "") override;
    bool isCancelTask() override;

    ~GameTask();

private:
    //检查角色是否移动
    void checkMove();
    //检查是否是地府
    void checkHell();

    void checkToken();

    void netCallBack(AuthCodeInfoBean authCodeInfo);

    bool isRun = true;
    QMetaObject::Connection backgroundCon;
    QMetaObject::Connection con;
private:
    QPoint qPrePoint;
    QTimer *qTimer = new QTimer();
    QTimer *checkTokenTimer = new QTimer();
    QMetaObject::Connection dis;
    QWidget *parent;


signals:
    //角色在地府才发送信号
    void isHell();

};

#endif // TASK_H
